// 导入vue-router创建路由
import { createRouter, createWebHistory } from 'vue-router'
// 导入组件
import LayoutVue from '@/views/Layout.vue'

const routes = [
  // () => import('@/views/login.vue')   懒加载 === import Loginvue from '@/views/login.vue'

  { path: '/login', component: () => import('@/views/login.vue') },
  {
    path: '/',
    component: LayoutVue,
    // 重定向 默认访问 /article/category
    redirect: '/article/category',
    //子路由
    children: [
      { path: '/article/category', component: () => import('@/views/article/ArticleCategory.vue') },
      { path: '/article/manage', component: () => import('@/views/article/ArticleManage.vue') },
      { path: '/user/info', component: () => import('@/views/user/UserInfo.vue') },
      { path: '/user/avartar', component: () => import('@/views/user/UserAvatar.vue') },
      { path: '/user/password', component: () => import('@/views/user/UserResetPassword.vue') },

    ]
  }

]

const router = createRouter({
  history: createWebHistory(),
  routes: routes
})
export default router